{include file="header.html"}
<div id="rightTop">
  <p>{$lang.banner_setting}</p>
  <ul class="subnav">
    <!--{if $smarty.get.wait_verify}-->
    <li><a class="btn1" href="index.php?app=banner_setting">{$lang.manage}</a></li>
    <!--{else}-->
    <li><span>{$lang.manage}</span></li>
    <!--{/if}-->
    <li><a class="btn1" href="index.php?app=banner_setting&amp;act=add">{$lang.add}</a></li>
  </ul>
</div>
<div class="mrightTop">
  <div class="fontl">
    <form method="get" action="index.php?app=banner_setting&act=index">
      <input type="hidden" name="app" value="banner_setting" />
      <input type="hidden" name="act" value="index" />
       <div class="left">
          {$lang.sgrade}:
          <select class="querySelect" name="sgrade">
            <option value="">{$lang.select_pls}</option>
            <option value="1">首页banner轮播图</option>
            <option value="2">商品列表轮播图</option>
            <option value="3">商品分类轮播图</option>
            <option value="4">个人中心轮播图</option>
          </select>
          <input type="submit" class="formbtn" value="{$lang.query}" />
      </div>
      <!--{if $filtered}-->
      <a class="left formbtn1" href="index.php?app=store<!--{if $smarty.get.wait_verify}-->&amp;wait_verify={$smarty.get.wait_verify}<!--{/if}-->">{$lang.cancel_query}</a>
      <!--{/if}-->
    </form>
  </div>
  <div class="fontr">{include file=page.top.html} </div>
</div>
<div class="tdare">
  <table width="100%" cellspacing="0" class="dataTable">
    <!--{if $banners}-->
    <tr class="tatr1">
      <td width="20" class="firstCell"><input type="checkbox" class="checkall" /></td>
      <td class="table-center">ID</td>
      <td class="table-center">{$lang.banner_remark}</span></td>
      <td class="table-center">有效商品数</td>
      <td class="table-center">点击数</td>
      <td class="table-center">{$lang.banner_url}</span></td>
      <td class="table-center">{$lang.detail_url}</span></td>
      <td class="table-center">跳转方式</span></td>
      <!--{if !$smarty.get.wait_verify}-->
      <td class="table-center"><span ectype="order_by" fieldname="sort_order">{$lang.sort_order}</span></td>
      <!--{/if}-->
      <td class="table-center">状态</span></td>
      <td class="handler" style="width: 160px;">{$lang.handler}</td>
    </tr>
    <!--{/if}-->
    <!--{foreach from=$banners item=banner key=k}-->
    <tr class="tatr2">
      <td class="firstCell"><input type="checkbox" class="checkitem" value="{$banner.banner_id}" /></td>
      <td class="table-center">{$banner.banner_id}</td>
      <td class="table-center">{$banner.banner_remark}</td>
      <td class="table-center" id="count_goods{$k}">0</td>
      <td class="table-center">{$banner.amount}</td>
      <td class="table-center">{if $banner.banner_url}<img src="{$banner.banner_url}?{$random_number}" height="30"/>{/if}</td>
      <td class="table-center">{if $banner.detail_url}<img src="{$banner.detail_url}?{$random_number}" height="30"/>{/if}</td>
      <td class="table-center">{$banner.jump_type_value}</td>
      <!--{if $banner.type eq 1}-->
      <td class="table-center">首页banner轮播图</td>
      <!--{elseif $banner.type eq 2}-->
      <td class="table-center">商品列表轮播图</td>
      <!--{elseif $banner.type eq 3}-->
      <td class="table-center">商品分类轮播图</td>
      <!--{elseif $banner.type eq 4}-->
      <td class="table-center">个人中心轮播图</td>
      <!--{/if}-->
      <!--{if !$smarty.get.wait_verify}-->
      <td class="table-center"><span ectype="inline_edit" fieldname="sort_order" fieldid="{$store.store_id}" datatype="pint" title="{$lang.editable}" class="editable">{$banner.sort_order}</span></td>
      <!--{/if}-->
      <!--{if $banner.preview eq 2}-->
      <td class="table-center">待上架</td>
      <!--{else}-->
      <td class="table-center">已上架</td>
      <!--{/if}-->
      <td class="handler">
        <!--{if !$smarty.get.wait_verify}-->
        <!--{if $banner.preview eq 2}-->
        <a href="javascript:drop_confirm('您确定要上架吗', 'index.php?app=banner_setting&amp;act=cancelPreview&amp;id={$banner.banner_id}&amp;preview=1');">上架</a> |
        <!--{else}-->
        <a href="javascript:drop_confirm('您确定要下架吗', 'index.php?app=banner_setting&amp;act=cancelPreview&amp;id={$banner.banner_id}&amp;preview=2');">下架</a> |
        <!--{/if}-->
        <!--<a href="index.php?app=banner_setting&amp;act=goods_item&amp;id={$banner.banner_id}" >测试</a> |-->
        <a href="javascript:;" class="preview" data-id="{$banner.banner_id}">预览</a> |
        <a href="index.php?app=banner_setting&amp;act=edit&amp;id={$banner.banner_id}">{$lang.edit}</a> | <a href="javascript:drop_confirm('{$lang.drop_confirm}', 'index.php?app=banner_setting&amp;act=drop&amp;id={$banner.banner_id}');">{$lang.drop}</a>
        <!--{else}-->
        <a href="index.php?app=banner_setting&amp;act=view&amp;id={$banner.banner_id}">{$lang.view}</a>
        <!--{/if}--></td>
    </tr>
    <div class ="bg-model{$banner.banner_id}" style="float:right;position:absolute;top:0%;left:44%;display:none;background:rgba(255,255,255,0.3);width:30%;height:100%;">
      <iframe src="index.php?app=banner_setting&act=preview&id={$banner.banner_id}"  width="100%" height="90%" style="background-color: white">
      </iframe>
    </div>
    <!--{foreachelse}-->
    <tr class="no_data">
      <td colspan="12">{$lang.no_data}</td>
    </tr>
    <!--{/foreach}-->
  </table>
  <!--{if $banner}-->
  <div id="dataFuncs">
    <div class="pageLinks">
      {include file=page.bottom.html}
    </div>
    <input type="hidden" name="banner_ids" value="{$ads}">
    <div id="batchAction" class="left paddingT15">
      <input class="formbtn batchButton" type="button" value="{$lang.drop}" name="id" uri="index.php?app=banner_setting&act=drop" presubmit="confirm('{$lang.drop_confirm}');" />
    </div>
  </div>
  <div class="clear"></div>
  <!--{/if}-->

</div>
{include file="footer.html"}
<script>
    $(document).ready(function(){
        var banner_ids = $("input[name=banner_ids]").val();
        $.post("index.php?app=banner_setting&act=banner_ids",{
            banner_ids:banner_ids
        },function(data){
            var res = JSON.parse(data);
            $.each(res,function(index,item){
                $("#count_goods"+item.banner_id).html(item.count_goods)
            })
        })
    })
    $(".preview").click(function () {
        var id = $(this).attr('data-id');
        $("iframe").contents().find(".checkitem:checked");
        $("iframe").contents().find(".checkitem:checked").each(function () {
            $(this).removeAttr('checked');
        })
        $("iframe").contents().items = '';
        $(".bg-model"+id).fadeTo(300,1)
        //隐藏窗体的滚动条
        $("body").css({ "overflow": "hidden" });
    });
</script>